package com.minelx.datamicroscope.querylanguage.data.content;

import com.alibaba.fastjson.JSONObject;

import java.util.Collection;
import java.util.List;

import static java.util.stream.Collectors.toList;

class ListedContent implements Content {
    private final List<Content> contents;

    ListedContent(List<Content> contents) {
        this.contents = contents;
    }

    @Override
    public List<JSONObject> toJSON() {
        return contents.stream()
                .map(Content::toJSON).flatMap(Collection::stream)
                .collect(toList());
    }
}
